﻿<Window x:Class="WPF_ActiveDataObject.ActiveSpeechRecognitionEngine"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:system="clr-namespace:System;assembly=mscorlib"
        xmlns:speech="clr-namespace:System.Speech.Recognition;assembly=System.Speech"
        Title="Demo"
        Height="300"
        Width="300">
    <FrameworkElement.Resources>
        <speech:SpeechRecognitionEngine x:Key="SRE" />
    </FrameworkElement.Resources>
    <Viewbox>
        <StackPanel>
            <TextBlock>
                    <Run Text="DateTime.Now: " />
                    <TextBlock DataContext="{x:Static system:DateTime.Now}"
                               Text="{Binding Now}" />
            </TextBlock>
            <StackPanel DataContext="{StaticResource SRE}">
                <StackPanel Orientation="Horizontal">
                    <Label Content="Audio Level:" />
                    <ProgressBar Minimum="0"
                                 Maximum="100"
                                 Width="100"
                                 Height="10"
                                 Value="{Binding AudioLevel, Mode=OneWay}" />
                </StackPanel>
                <TextBlock>
                    <Run Text="Audio State: " />
                    <TextBlock Text="{Binding AudioState}" />
                </TextBlock>
                <TextBlock>
                    <Run Text="Audio Signal Problem: " />
                    <TextBlock Text="{Binding AudioSignalProblem.AudioSignalProblem}" />
                </TextBlock>
                <Label Content="Hypothesization:" />
                <StackPanel DataContext="{Binding Hypothesization.Result}">
                    <ItemsControl ItemsSource="{Binding Words}">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapPanel ScrollViewer.CanContentScroll="False" />
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate DataType="speech:RecognizedWordUnit">
                                <StackPanel>
                                    <TextBlock Text="{Binding Text}" />
                                    <TextBlock Foreground="Gray"
                                               FontSize="6"
                                               Text="{Binding Confidence}" />
                                </StackPanel>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </StackPanel>
            </StackPanel>
        </StackPanel>
    </Viewbox>
</Window>
